<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>图片切换</title>
    <link rel="stylesheet" href="./css/index2.css"/>
</head>

<body>
    <div id="mask">
        <div class="center">
            <h2 class="title">
                <img src="./img/2/logo.png" alt="">
                深圳创维校区环境
            </h2>
            <!-- 图片 -->
            <img :src="imgArr[index]" alt="" />
            <!-- 左箭头 -->
            <a href="javascript:void(0)" v-show="index>0" @click="prev" class="left">
                <img src="./img/2/prev.png" alt="" />
            </a>
            <!-- 右箭头 -->
            <a href="javascript:void(0)" v-show="index<imgArr.length-1" @click="next" class="right">
                <img src="./img/2/next.png" alt="" />
            </a>
        </div>
    </div>

    <script src="./js/utils/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#mask",
            data: {
                imgArr: [
                    "./img/2/00.jpg",
                    "./img/2/01.jpg",
                    "./img/2/02.jpg",
                    "./img/2/03.jpg",
                    "./img/2/04.jpg",
                    "./img/2/05.jpg",
                    "./img/2/06.jpg",
                    "./img/2/07.jpg",
                    "./img/2/08.jpg",
                    "./img/2/09.jpg",
                    "./img/2/10.jpg",
                ],
                index: 0
            },
            methods: {
                prev: function() {
                    this.index--;
                },
                next: function() {
                    this.index++;
                }
            },
        })
    </script>
</body>
</html>